Skip to content

gh-158380: Fix the stack operand used by JIT dict access guards - #158381

Open
cocolato wants to merge 2 commits into
python:mainfrom
cocolato:bug/dict_guard
Open

cocolato wants to merge 2 commits into
python:mainfrom
cocolato:bug/dict_guard

Conversation

@cocolato

@cocolato cocolato commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

The probable type branches of _GUARD_NOS_DICT_SUBSCRIPT and _GUARD_NOS_DICT_STORE_SUBSCRIPT now check the dict at NOS:

Stack (top on the right):
  Read:  ... mapping, key
  Write: ... value, mapping, key

Before: _GUARD_TYPE     checks type(key)     == expected_type
After:  _GUARD_NOS_TYPE checks type(mapping) == expected_type

Reuse the existing NOS guard by renaming _GUARD_TYPE_ITER to _GUARD_NOS_TYPE, update its iterator call site, and regenerate the affected files fix this issue. Known-type paths still omit the guard.

@cocolato cocolato added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant